<%-- 
    Document   : db1
    Created on : 2014/8/19, 下午 01:34:39
    Author     : gjun
--%>

<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/javadb","root","root");
Statement st=con.createStatement();
String sql="insert into person(username,tel,birthday)values('Bob','03-222222','2000/01/01')";
int x=st.executeUpdate(sql);
st.close();
con.close();//連線的localhost是本機，如果是要連其他電腦則改輸入其他電腦的ip
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>連線及驅動的執行</title>
    </head>
    <body>
        <h1>Hello World!</h1>
        <%=  x  %>
    </body>
</html>
